Redim Method

Resizes the passed array.

Syntax

Redim newSize1, [newSizeN]


Parameters

newSize1

Integer

The new size for the array. In the case of multi-dimensional arrays, the new size for the first dimension of the array.

newSizeN (Optional)

Integer

The new size for the Nth dimension of the array.



Notes

The Redim method is used to increase or reduce the number of elements in the array specified. Arrays are zero-based (the first element is zero) so you resize the array using a number that is one less than the number of elements you actually want.


Examples

This example reduces the aNames array to 11 elements.

Redim aNames(10)

This example adds 10 elements to the aNames array

Redim aNames( Ubound(aNames)+10)

.

This example reduces the aPeople array to 11 elements for the first dimension and 6 elements for the second dimension

Redim aPeople(10,5)

.


See Also

Dim statement; Array, Join, Split, Ubound functions; Append, IndexOf, Insert, Pop, Remove, Shuffle, Sort, Sortwith methods; ParamArray keyword.